package com.ipzoe.mem.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ipzoe.mem.domain.MemberRechargePackage;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ipzoe.mem.mapper.DealerMapper;
import com.ipzoe.mem.domain.Dealer;
import com.ipzoe.mem.service.IDealerService;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;

/**
 * 经销商Service业务层处理
 *
 * @author eric
 * @date 2020-08-20
 */
@Service
public class DealerServiceImpl extends ServiceImpl<DealerMapper, Dealer> implements IDealerService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean removeByIds(Collection<? extends Serializable> idList, String updateBy) {

        boolean result = update(Wrappers.<Dealer>lambdaUpdate().set(Dealer::getUpdateBy, updateBy)
                .set(Dealer::getUpdateTime, new Date())
                .in(Dealer::getId, idList));

        return result && removeByIds(idList);
    }
}
